<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>分页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav aria-label="Page navigation" th:fragment="pageUser">
    <ul class="pagination">
        <div >
            <div  th:if="${totalPages}!=null">
                共:<a th:text="${totalPages}"></a>页
                当前是第<a th:text="${pageNumber}"></a>页
            </div>
            <form method="get" action="/manager/look/user">
                <input name="word" th:value="${word}" th:hidden="word">
                <input name="size" th:value="${size}" th:hidden="size">
                跳转至:<input name="pageNumber" type="text">
                <input type="submit" value="sumbit">
            </form>
            <div  >
            <a th:href="@{/manager/look/user(pageNumber=0,word=${word},size=3)}">第一页</a>
            <!--上一页的判断-->
            <div   th:if="${pageNumber}-'2'>=0">
                <a th:href="@{/manager/look/user(pageNumber=(${pageNumber}-'2'),word=${word},size=3)}">上一页</a>
            </div>
            <div    th:if="${pageNumber}-'2'<0">
                <a th:href="@{/manager/look/user(pageNumber=0,word=${word},size=3)}">上一页</a>
            </div>
            <!--下一页-->
            <div th:if="${totalPages}-'1'<${pageNumber}">
                <a th:href="@{/manager/look/user(pageNumber=${totalPages}-'1',word=${word},size=3)}">下一页</a>
            </div>
            <div th:if="${totalPages}-'1'>=${pageNumber}">
                <a th:href="@{/manager/look/user(pageNumber=${pageNumber},word=${word},size=3)}">下一页</a>
            </div>
            <a th:href="@{/manager/look/user(pageNumber=${totalPages}-'1',word=${word},size=3)}">尾页</a>
            </div>
        </div>
    </ul>
</nav>

<nav aria-label="Page navigation" th:fragment="pageBolg">
    <ul class="pagination">
        <div th:if="${totalPages}!=null">
            共:<a th:text="${totalPages}"></a>页
            当前是第<a th:text="${pageNumber}"></a>页
        </div>

        <form method="get" action="/look/bolg/list">
            <input name="word" th:value="${word}" th:hidden="word">
            <input name="size" th:value="${size}" th:hidden="size">
            跳转至:<input name="pageNumber" type="text" >
            <input type="submit" th:value="sumbit">
        </form>

        <a th:href="@{/look/bolg/list(pageNumber=0,word=${word},size=3)}">第一页</a>
        <!--上一页-->
        <div th:if="${pageNumber}>=0">
            <a th:href="@{/look/bolg/list(pageNumber=${pageNumber}-'2',word=${word},size=3)}">上一页</a>
        </div>
        <div th:if="${pageNumber}<0">
            <a th:href="@{/look/bolg/list(pageNumber=0,word=${word},size=3)}">上一页</a>
        </div>
        <!--下一页-->
        <div th:if="${totalPages}-'1'<${pageNumber}">
            <a th:href="@{/look/bolg/list(pageNumber=${totalPages}-'1',word=${word},size=3)}">下一页</a>
        </div >
        <div th:if="${totalPages}-'1'>=${pageNumber}">
            <a th:href="@{/look/bolg/list(pageNumber=${pageNumber},word=${word},size=3)}">下一页</a>
        </div >
        <!--尾页-->
        <a th:href="@{/look/bolg/list(pageNumber=${totalPages}-'1',word=${word},size=3)}">尾页</a>
    </ul>
</nav>

</body>
</html>